{% extends "base.html" %}

{% block content %}
<h1>Профиль пользователя {{ user.username }}</h1>

<form method="POST" enctype="multipart/form-data">
    {% csrf_token %}
    {% if user.photo %}
    <p>
        <img src="{{ user.photo.url }}" alt="">
    </p>
    {% else %}
    <p>
        <img src="{{ default_image }}" alt="">
    </p>
    {% endif %}
    <div class="form-error">{{ form.non_field_errors }}</div>
    {% for f in form %}
    <p>
        <label class="form-label" for="{{ f.id_for_label }}">
            {{ f.label }}:
        </label>
        {{ f }}
    </p>
    <div class="form-error">{{ f.errors }}</div>
    {% endfor %}
    <p>
        <button type="submit">
            Сохранить
        </button>
    </p>
</form>
<hr>
<p>
    <a href="{% url 'users:password_change' %}">Сменить пароль</a>
</p>
{% endblock %}